CREATE PROCEDURE coreWFProcessStartSave
(
	@id					int output,
	@FK_ProcessID		int,
	@Rank				int,
	@Method				nvarchar(500),
	@PropertyBag		ntext
)
AS
BEGIN

	IF @id = -1
	BEGIN
		SET NOCOUNT ON;

		INSERT INTO WFProcessStart ( FK_ProcessID, Rank, Method, PropertyBag )
		VALUES ( @FK_ProcessID, @Rank, @Method, @PropertyBag );

		SET NOCOUNT OFF;
		SELECT @id = @@IDENTITY;

	END
	ELSE
	BEGIN
		
		UPDATE WFProcessStart SET
			Rank			= @Rank,
			Method			= @Method,
			PropertyBag		= @PropertyBag
		WHERE PK_ID=@id;	
	END
	
END
